package main

import "fmt"

type base struct {
	num int
}

func (b *base) describe() string {
	return fmt.Sprintf("base with num=%v", b.num)
}

type container struct {
	base
	str string
	num int
}

type simpleMath interface {
	double() string
}

func (c *container) double() string {
	return fmt.Sprintf("double with num=%v", c.num*2)
}

func main() {
	co := container{
		base: base{
			num: 1,
		},
		str: "some name",
		num: 100,
	}
	fmt.Printf("co={num: %v, str: %v}\n", co.num, co.str)
	fmt.Println("also num:", co.base.num)
	fmt.Println("describe:", co.describe())
	fmt.Println("double:", co.double())

	var sm simpleMath = &co
	fmt.Println("simpleMath:", sm.double())

	type describer interface {
		describe() string
	}
	var d describer = &co
	fmt.Println("describer:", d.describe())
}
